﻿#include "webui/Query.h"

#include <boost/spirit/include/classic.hpp>

namespace webui {

	Query::RVar Query::operator[]( const std::string& key ) const
	{
		using namespace BOOST_SPIRIT_CLASSIC_NS;
		parse
			( query_.c_str()
			, (str_p(key.c_str()) >> ch_p('=') >> (*(anychar_p-'&')) [assign_a(value_)] | *(anychar_p-'&')) % '&'
			);
		return RVar(value_);
	}

	Query::Query( const std::string& rhs ) : query_(rhs)
	{
	}

} // namespace webui